//
//  YZMRedPacketNoCell.m
//  YZMicroStock
//
//  Created by apple on 17/5/2.
//  Copyright © 2017年 cqjr. All rights reserved.
//

#import "YZMRedPacketNoCell.h"

@implementation YZMRedPacketNoCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createObjects];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}

- (void)createObjects {
    
    WS(ws)
    
    UIImageView *noneImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iocn_redPactet_none"]];
    [self addSubview:noneImageView];
    [noneImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(ws);
        make.top.equalTo(ws).offset(ceil((ScreenHeight - 185) * 0.1));
    }];
    
    UILabel *label = [YZMAppStyle labelWithSmallLightGray];
    label.text = [NSString stringWithFormat:@"您还没有获得红包\n快来参加活动，红包正在召唤你"];
    label.textAlignment = NSTextAlignmentCenter;
    label.numberOfLines = 0;
    [self addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(ws);
        make.top.equalTo(noneImageView.mas_bottom).offset(15);
    }];
    
    UIButton *addBtn  = [YZMAppStyle submitButton];
    addBtn.enabled = YES;
    [addBtn setTitle:@"更多红包活动" forState:UIControlStateNormal];
    [self addSubview:addBtn];
    [addBtn addTarget:self action:@selector(addButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
    [addBtn mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(ws).offset(15);
        make.right.equalTo(ws).offset(-15);
        make.bottom.equalTo(ws.mas_bottom).offset(-ceil((ScreenHeight - 185) * 0.3));
    }];
}

-(void)addButtonPressed:(UIButton *)sender{
    
    [YZMCMInstance pushByCheckingAuthWithName:@"activity" andParams:nil];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
